<?php


namespace app\index\controller;

class Index extends \app\common\Controller
{
	public function index()
	{
		if (!(new Install())->IsInstall()) {
			$this->redirect("/install");
		}
		$domain = \think\facade\Request::host();
		$app = \think\Db::name("app")->where(["home_domain" => $domain])->find();
		if (!empty($app)) {
			return (new App())->home($app["id"]);
		}
		$website = \app\common\server\ConfigServer::get("website");
		$this->assign("website", $website);
		$template_config = \app\system\service\ConfigService::get_home_template_config_data();
		$this->assign("config", $template_config["config"]);
		return $this->fetch($template_config["view"]);
	}
}